#include "NetworkSystem.h"

IBackEndModule::~IBackEndModule() // unhook all events when the module is released
{
	std::vector<long>::iterator iter = Events.begin();
	while (iter != Events.end())
	{
		netSys.UnHookEvent(e, this);
		iter++;
	}
}

void IBackEndModule::HookEvent(long e)
{
	Events.push_back(e);
	netSys.HookEvent(e, this);
}

void IBackEndModule::UnHookEvent(long e)
{
	std::vector<long>::iterator iter = Events.find(e);
	if (iter != Events.end())
	{
		Events.erase(iter);
		netSys.UnHookEvent(e, this);
	}
}